import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    mxid:0,
    grData: 0,
    timer: null
  },
  getters: {
    afterData: (state) => {
      return state.grData + 1
    }
  },
  mutations: {
    setMxid(state,id){
      state.mxid = id
    },
    startTimer(state, timer) {
      state.timer = timer
    },
    endTimer(state) {
      clearInterval(state.timer)
    },
    add(state) {
      state.grData++
    },
    cut(state) {
      state.grData--
    },
    payload(state, data) {
      state.grData = data
    }
  }
})